package com.mall.util.distributed.raft.rpc.message;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 追加条目
 * 心跳就是无有效消息的追加条目
 */
@Data
@Accessors(chain = true)
public class AppendEntries implements Serializable {
    @Schema(description = "领导者任期")
    private long term;

    @Schema(description = "领导者 ID,便于去重定向")
    private String leaderId;

    @Schema(description = "跟随者与leader同步后的最新日志索引")
    private String preLogIndex;

    @Schema(description = "跟随者与leader同步后的最新日志任期")
    private String preLogTerm;

    @Schema(description = "准备存储的日志条目")
    private LogEntry[] entries;

    @Schema(description = "领导人已经提交的日志的索引值")
    private String commitIndex;
}
